import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  build:{
    lib : {
      entry : 'src/index.js',
      name : 'bwy-ui',
      fileName: (format) => `bwy-ui.${format}.js` 
    },
    rollupOptions : {
      external : ['vue'],
      output: {  
        globals: {  
          vue: 'Vue'  
        }  
      } 
    }
  },
  resolve : {
    alias: {  
      '@': './src'  // 注意：这里应该是 './src'，而不是 '/src'  
    }  
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@import "@/assets/styles/index.scss";`
      }
    }
  }
})
